package tk.mynoteapp.dev.common;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.Properties;

public class Utils {
    private final static Logger logger = LoggerFactory.getLogger(Utils.class);
    public static void loadPropertySource(Class clazz, String fileName) {
        Properties p = new Properties();
        try {
            p.load(clazz.getResourceAsStream(fileName));
            p.forEach((k, v) -> {
                logger.info("{}={}", k, v);
                System.setProperty(k.toString(), v.toString());
            });
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
